package WaiBao;

import java.util.Arrays;

public class NiuYangXia {
    public static void main(String[] args) {
        String[] name = {"王硕(班长)", "王璨(团支书)", "小李(学习委员)", "王秀(组织委员)", "王生", "王某", "王瑞", "王陆", "马超", "马谡", "马腾", "马良",
                "王府", "王双", "于金", "魏静", "山桃", "王平", "李隆基", "黄超", "吉鲁", "内马尔", "姆巴佩", "屈原", "杜牧", "张九龄", "高适", "陶渊明",
                "司马迁", "牛杨霞(学生)"};//考生本人: 牛杨霞(学生)
        int[] Age = {21, 20, 18, 20, 20, 21, 21, 20, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 21, 20, 19};//考生年龄：19岁


        double[] cure1 = {91, 84, 90, 86, 78, 69, 78, 89, 80, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 81, 95};
        double[] cure2 = {80, 65, 74, 78, 88, 74, 88, 79, 90, 80, 90, 79, 86, 76, 65, 65, 80, 79, 66, 68, 92, 71, 95, 81, 75, 84, 79, 94, 95, 96};
        double[] cure3 = {77, 96, 90, 85, 71, 69, 78, 89, 80, 60, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 84, 96};


        double lady1;//代表每个学生的总分
        double lady2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            lady1 = cure1[i] + cure2[i] +cure3[i];
//            lady2 = ( lady1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + lady1);
//            System.out.println(name[i] + "的平均分为:" +lady2);
//        }


        double shikong1 = 0, shikong2 = 0;
//        double[] kk = new double[30];
//        for (int i = 0; i < 30; i++) {
//            shikong1 = cure1[i] + cure2[i] +cure3[i];
//            shikong2 = (shikong1 * 1.0) / 3;
//            kk[i] = shikong2;
//        }
//
//        for (int i = 0; i <kk.length - 1; i++) {
//            for (int j = 0; j < kk.length - i - 1; j++) {
//                if (kk[j] < kk[j + 1]) {
//                    double tep = kk[j];
//                    kk[j] = kk[j + 1];
//                    kk[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(kk[i]);
//        }


        double nian1 = 0,nian2 = 0, nian3 = 0;//计算每门课的平均分
        double gequ1 = 0,gequ2 = 0, gequ3 = 0;//计算每门课标准差
        double buzai1 = 0, buzai2 = 0, buzai3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <cure1.length; i++) {
            sum2+=cure1[i];
        }
        nian1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+nian1);
        double Sum = 0;
        for (int i = 0; i < cure2.length; i++) {
            Sum+=cure2[i];
        }
        nian2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+nian2);
        double sum = 0;
        for (int i = 0; i <cure3.length; i++) {
            sum+=cure3[i];
        }
        nian3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+nian3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <cure1.length; i++) {
            c1+= (cure1[i] -nian1)*(cure1[i] - nian1);
        }
        gequ1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+gequ1);

        for (int i = 0; i < cure2.length; i++) {
            c2+= (cure2[i] - nian2)*(cure2[i] - nian2);
        }
        gequ2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+gequ2);

        for (int i = 0; i < cure3.length; i++) {
            c3+= (cure3[i] -nian3)*(cure3[i] - nian3);
        }
        gequ3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+gequ3);
////
////
//        Arrays.sort(cure1);
//        Arrays.sort(cure2);
//        Arrays.sort(cure3);
//        buzai1 =( cure1[14]+cure1[15])*1.0/2;
//        buzai2 =( cure2[14]+cure2[15])*1.0/2;
//        buzai3 =( cure3[14]+cure3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+buzai1);
//        System.out.println("微生物学的中位数为:"+buzai2);
//        System.out.println("人体组织解剖学的中位数为:"+buzai3);


    }
}
